package org.tp;

import java.io.FileReader;
import java.util.HashMap;
import java.util.Map;

import java_cup.runtime.Symbol;

public class Main {

	static Env firstEnv=null;
	static Env currentEnv=null;

	static MyFichier f;
	static Declarations d;
	static Prototypes p;
	static Fonctions func;

	public static void main(String[] args) {
		try {		
			f = new MyFichier();
			d = new Declarations();
			p = new Prototypes();
			func = new Fonctions();
			
			FileReader  myFile = new FileReader(args[0]);
			TpLexer myLex = new TpLexer(myFile);
			TpParser myP = new TpParser(myLex);
			Symbol result=null;
			
			try {
				result=myP.parse();
				try {
					AbSynt root=(AbSynt)result.value;
					System.out.println(root.toString());
					//root.toDot("detruire");
				}	
				catch (Exception e) {
					System.out.println("result error");
				}
			}
			catch (Exception e) {
				System.out.println("parse error main...");
			}
		}
		catch (Exception e){
			System.out.println("invalid file");	    
		}
	}
}
